package  main


import (
	"fmt"
)

type Car interface {
	Say()
}


type Bmw string


func (this Bmw)Say(){

	fmt.Println("被调用了")
}

func checkType(i interface{}){

	switch v := i.(type){

	case Car:
		v.Say()
	case string:
		fmt.Println("String类型的变量")
	default:
		fmt.Println("unknown type\n")
	}


}

func main(){

	a := "hehe"
	checkType(a)

	b := Bmw("hehe")	//Bmw其实可以实现多个接口
	checkType(b)
}

